package com.srd.phone.bean;

import android.text.TextUtils;

import org.json.JSONException;
import org.json.JSONObject;

public class ResultInfo {

    public String data;
    public int count;
    public int code;
    public String msg;

    public static ResultInfo parse(String json) {
        ResultInfo info = new ResultInfo();
        try {
            JSONObject jsonObject = new JSONObject(json);
            info.data = jsonObject.optString("data");
            info.count = jsonObject.optInt("count");
            info.code = jsonObject.optInt("code");
            info.msg = jsonObject.optString("msg");
            if (TextUtils.isEmpty(info.msg)) {
                info.msg = jsonObject.optString("message");
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return info;
    }
}
